Skip to content

feat: Add Modular Pipeline for Stable Diffusion 3 (SD3)#13324

Open
AlanPonnachan wants to merge 7 commits intohuggingface:mainfrom
AlanPonnachan:feat/sd3-modular-pipeline
Open

feat: Add Modular Pipeline for Stable Diffusion 3 (SD3)#13324
AlanPonnachan wants to merge 7 commits intohuggingface:mainfrom
AlanPonnachan:feat/sd3-modular-pipeline

Conversation

@AlanPonnachan
Copy link
Copy Markdown
Contributor

What does this PR do?

This PR introduces the modular architecture for Stable Diffusion 3 (SD3), implementing both Text-to-Image (T2I) and Image-to-Image (I2I) pipelines.

Key additions:

  • Added SD3ModularPipeline and SD3AutoBlocks to the dynamic modular pipeline resolver.
  • Migrated SD3-specific mechanics to the new BlockState
  • Added corresponding dummy objects and lazy-loading fallbacks.
  • Added TestSD3ModularPipelineFast and TestSD3Img2ImgModularPipelineFast test suites.

Related issue: #13295

Before submitting

Who can review?

@sayakpaul @asomoza

class TestSD3Img2ImgModularPipelineFast(ModularPipelineTesterMixin):
pipeline_class = SD3ModularPipeline
pipeline_blocks_class = SD3AutoBlocks
pretrained_model_name_or_path = "hf-internal-testing/tiny-sd3-pipe"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests currently point to hf-internal-testing/tiny-sd3-pipe. So tests are failing as of now. I think this happens since /tiny-sd3-pipe lacks modular_model_index.json.

could someone on the team push a hf-internal-testing/tiny-sd3-modular testing repository with a modular_model_index.json?

Once that infrastructure is available on the Hub, I will update the pretrained_model_name_or_path and run my tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for now, we could first load "hf-internal-testing/tiny-sd3-pipe" in a ModularPipeline and then save and push to a repository on the Hub. We can use it throughout and PR. Once the PR is close to merge, we can transfer the repo to the "hf-internal-testing" org. Does that work?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Done!

@sayakpaul sayakpaul requested review from asomoza and yiyixuxu March 25, 2026 02:22
@sayakpaul
Copy link
Copy Markdown
Member

sayakpaul commented Mar 25, 2026

@AlanPonnachan thanks for this PR! Could you also provide some test code and sample outputs?

Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting started on this! I left some comments (majorly on the use of guidance).

@sayakpaul
Copy link
Copy Markdown
Member

@claude can you review this?

@claude
Copy link
Copy Markdown

claude bot commented Mar 28, 2026

Claude Code is working…

I'll analyze this and get back to you.

View job run

@sayakpaul
Copy link
Copy Markdown
Member

@bot /style

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 28, 2026

Style bot fixed some files and pushed the changes.

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants